package c03_define_exception;

import java.util.Scanner;

/**
 * UsernameAlreadyExists
 */
public class Test {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入用户名：");
        String username = sc.nextLine();
        if (username.equals("admin")) {
            throw new UsernameAlreadyExists("用户名已存在");
        }
        else {

            System.out.println("注册成功");
        }
        System.out.println("程序结束");
    }
}
